package org.anarcoding.twitterbot.view;

import org.anarcoding.twitterbot.model.AnarcoTwitterBotConf;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.SWT;
import org.eclipse.wb.swt.SWTResourceManager;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Button;

public class CmpAnarcoTwitterBotConf extends Composite {
	private Text							txtConsumerKey;
	private Text							txtConsumerSecret;
	private Text							txtTwitterToken;
	private Text							txtTwitterTokenSecret;
	private Label							lblShowAlias;
	private Button							btnAdherir;

	private ShlAnarcoTwitterBotConfControl	control;
	private AnarcoTwitterBotConf			nuevaConf;

	/**
	 * Create the composite.
	 * 
	 * @param parent
	 * @param style
	 */
	public CmpAnarcoTwitterBotConf( Composite parent, int style ) {
		super( parent, style );

		Group grpConfiguracinDeCuenta = new Group( this, SWT.NONE );
		grpConfiguracinDeCuenta.setFont( SWTResourceManager.getFont( "Tahoma", 7, SWT.BOLD ) );
		grpConfiguracinDeCuenta.setText( "CONFIGURACI\u00D3N DE CUENTA" );
		grpConfiguracinDeCuenta.setBounds( 0, 0, 365, 262 );

		Label lblNewLabel = new Label( grpConfiguracinDeCuenta, SWT.NONE );
		lblNewLabel.setFont( SWTResourceManager.getFont( "Tahoma", 8, SWT.NORMAL ) );
		lblNewLabel.setBounds( 10, 20, 345, 13 );
		lblNewLabel.setText( "Consumer key" );

		txtConsumerKey = new Text( grpConfiguracinDeCuenta, SWT.BORDER );
		txtConsumerKey.setFont( SWTResourceManager.getFont( "Tahoma", 8, SWT.BOLD ) );
		txtConsumerKey.setBounds( 10, 39, 345, 19 );

		Label lblConsumerSecret = new Label( grpConfiguracinDeCuenta, SWT.NONE );
		lblConsumerSecret.setText( "Consumer secret" );
		lblConsumerSecret.setFont( SWTResourceManager.getFont( "Tahoma", 8, SWT.NORMAL ) );
		lblConsumerSecret.setBounds( 10, 64, 345, 13 );

		txtConsumerSecret = new Text( grpConfiguracinDeCuenta, SWT.BORDER );
		txtConsumerSecret.setFont( SWTResourceManager.getFont( "Tahoma", 8, SWT.BOLD ) );
		txtConsumerSecret.setBounds( 10, 83, 345, 19 );

		Label lblTwitterToken = new Label( grpConfiguracinDeCuenta, SWT.NONE );
		lblTwitterToken.setText( "Twitter token" );
		lblTwitterToken.setFont( SWTResourceManager.getFont( "Tahoma", 8, SWT.NORMAL ) );
		lblTwitterToken.setBounds( 10, 108, 345, 13 );

		txtTwitterToken = new Text( grpConfiguracinDeCuenta, SWT.BORDER );
		txtTwitterToken.setFont( SWTResourceManager.getFont( "Tahoma", 8, SWT.BOLD ) );
		txtTwitterToken.setBounds( 10, 127, 345, 19 );

		Label lblTwitterSecret = new Label( grpConfiguracinDeCuenta, SWT.NONE );
		lblTwitterSecret.setText( "Twitter toket secret" );
		lblTwitterSecret.setFont( SWTResourceManager.getFont( "Tahoma", 8, SWT.NORMAL ) );
		lblTwitterSecret.setBounds( 10, 152, 345, 13 );

		txtTwitterTokenSecret = new Text( grpConfiguracinDeCuenta, SWT.BORDER );
		txtTwitterTokenSecret.setFont( SWTResourceManager.getFont( "Tahoma", 8, SWT.BOLD ) );
		txtTwitterTokenSecret.setBounds( 10, 171, 345, 19 );

		btnAdherir = new Button( grpConfiguracinDeCuenta, SWT.NONE );
		btnAdherir.setBounds( 205, 196, 150, 23 );
		btnAdherir.setText( "Adherir" );

		lblShowAlias = new Label( grpConfiguracinDeCuenta, SWT.NONE );
		lblShowAlias.setFont( SWTResourceManager.getFont( "Tahoma", 16, SWT.BOLD ) );
		lblShowAlias.setBounds( 10, 225, 345, 26 );

		Label label = new Label( grpConfiguracinDeCuenta, SWT.SEPARATOR | SWT.HORIZONTAL );
		label.setBounds( 10, 257, 345, 2 );

		control = new ShlAnarcoTwitterBotConfControl( this );

	}

	@Override
	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}

	public Text getTxtConsumerKey() {
		return txtConsumerKey;
	}

	public void setTxtConsumerKey( Text txtConsumerKey ) {
		this.txtConsumerKey = txtConsumerKey;
	}

	public Text getTxtConsumerSecret() {
		return txtConsumerSecret;
	}

	public void setTxtConsumerSecret( Text txtConsumerSecret ) {
		this.txtConsumerSecret = txtConsumerSecret;
	}

	public Text getTxtTwitterToken() {
		return txtTwitterToken;
	}

	public void setTxtTwitterToken( Text txtTwitterToken ) {
		this.txtTwitterToken = txtTwitterToken;
	}

	public Text getTxtTwitterTokenSecret() {
		return txtTwitterTokenSecret;
	}

	public void setTxtTwitterTokenSecret( Text txtTwitterTokenSecret ) {
		this.txtTwitterTokenSecret = txtTwitterTokenSecret;
	}

	public Label getLblShowAlias() {
		return lblShowAlias;
	}

	public void setLblShowAlias( Label lblShowAlias ) {
		this.lblShowAlias = lblShowAlias;
	}

	public Button getBtnAdherir() {
		return btnAdherir;
	}

	public void setBtnAdherir( Button btnAdherir ) {
		this.btnAdherir = btnAdherir;
	}

	public AnarcoTwitterBotConf getNuevaConf() {
		return nuevaConf;
	}

	public void setNuevaConf( AnarcoTwitterBotConf nuevoServicio ) {
		this.nuevaConf = nuevoServicio;

		if( nuevaConf != null )
			control.actualizaCampos();
	}
}
